Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-work how esy prefix is used to handle EXDEV errors. #21

Merged

Conversation

ManasJayanth
Copy link
Member

@ManasJayanth ManasJayanth commented Jun 26, 2024

With the newly introduced (still in beta) node_modules linker, the CI (as well as users) might run into EXDEV issues when esy hardlinks NPM dependencies from cache to a project path which is on a different drive. On Github Actions Windows runner, for instance, the HOMEPATH is usually on C:/ and working directory on D:/.

To work around this, the action is better of placing the esy stores (cache) in the same drive that it has access too. With some trial-and-error, I learn, all paths under D:/ is not necessarily writable. So, this PR computes esy prefix by simply traversing one level up in the current working directory path (where we have write accesss).

This however breaks user's assumptions - they'd expect this action to work just like esy does on local machines (i.e. place esy store at C:/ or $HOME/.esy. This means, if they simply run esy commands (for instance, if they wish to export esy dependencies as a relocatable cache with esy export-dependencies), it would not work because the prefix path on the CI is different from default on.

To work around this, this action must expose the computed path with GITHUB_ENV or something which users can access as they write CI scripts.

There's a separate UX related issue wrt esy itself when it comes to handling the EXDEV problem. It's being tracked here - since this problem is not evident in all cases - only if the project opts into the node_modules linker for NPM projects. Perhaps this action could use esy to figure if this custom prefix solution is needed in the first place, in a future PR.

On Windows, we ran into EXDEV issues when the cache drive and working
directory drive is different. When $HOME is changed to D:/ on Windows,
cache restore fails too

```
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man7/Ed448.7: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man7\\Ed448.7'
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man7/X448.7: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man7\\X448.7'
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man3/ACCESS_DESCRIPTION_free.3: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man3\\ACCESS_DESCRIPTION_free.3'
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man3/ACCESS_DESCRIPTION_new.3: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man3\\ACCESS_DESCRIPTION_new.3'
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man3/ADMISSIONS_free.3: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man3\\ADMISSIONS_free.3'
  ../../../.esy/3____________________________________________________________________________/i/esy_openssl-20afd0e0/share/man/man3/ADMISSIONS_get0_admissionAuthority.3: Can't create '\\\\?\\D:\\a\\dream-web-server-sessions\\dream-web-server-sessions\\..\\..\\..\\.esy\\3____________________________________________________________________________\\i\\esy_openssl-20afd0e0\\share\\man\\man3\\ADMISSIONS_get0_admissionAuthority.3'
```
@ManasJayanth
Copy link
Member Author

Perhaps this action could use esy to figure if this custom prefix solution is needed in the first place, in a future PR.

Opened an issue to track this:
#22

@ManasJayanth ManasJayanth merged commit 78b4c52 into master Jul 12, 2024
6 checks passed
@ManasJayanth ManasJayanth deleted the prometheansacrifice/fix-prefix-not-passed-to-esy-commands branch July 12, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant